<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="dashboard/header :: header"></head>
<body>

<!--
@desc 内容模块 更新
@author WeiXiaoJin
@since 2019-05-20 12:44:59
-->
	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<!-- /.col-->
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">

								<form class="form-horizontal" id="addForm" style="float:left;width:100%">
								
									<input type="hidden" name="formToken" th:value="${session.formToken}" />
									<input type="hidden" name="id" th:value="${bean.id}" />
									<input type="hidden" name="hasStatus" th:value="${bean.hasStatus}" />
									<input type="hidden" name="moduleDesign" th:value="${bean.moduleDesign}" />

<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">模块名称</label>
	<div class="col-md-9">
		<input class="form-control" id="moduleName" type="text" name="moduleName" th:value="${ bean.moduleName}" placeholder="模块名称">
	</div>
</div>
<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">模块链接</label>
	<div class="col-md-9">
		<input class="form-control" id="modulePath" type="text" name="modulePath" th:value="${ bean.modulePath}" placeholder="模块链接">
	</div>
</div>

<!-- 
<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">模块图标</label>
	<div class="col-md-9">
		<input class="form-control" id="moduleLogo" type="text" name="moduleLogo" th:value="${ bean.moduleLogo}" placeholder="模块图标">
	</div>
</div>
 -->
 
<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">图标</label>
	<div class="col-md-9">
		<span class="form-control select-icons" id="moduleLogoLabel" type="text" 
			   onclick="showFontIcons('moduleLogo','50')" 
			   name="moduleLogoLabel" 
			   readonly="readonly" style="padding-top: 6px;cursor: pointer;color:#02619a;text-align:center" placeholder="图标">
			<i th:class="${ bean.moduleLogo}" style="font-size:50px" aria-hidden="true"></i>
		</span>
		<input type="hidden" name="moduleLogo" th:value="${bean.moduleLogo}" id="moduleLogo" />
	</div>
</div>

<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">模块描述</label>
	<div class="col-md-9">
		<input class="form-control" id="moduleDesc" type="text" name="moduleDesc" th:value="${ bean.moduleDesc}" placeholder="模块描述">
	</div>
</div>
<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">模块排序</label>
	<div class="col-md-9">
		<input class="form-control" id="moduleSort" type="text" name="moduleSort" th:value="${ bean.moduleSort}" placeholder="模块排序">
	</div>
</div>
<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">所属菜单</label>
	<div class="col-md-9">
		<!-- 
		<input class="form-control" id="menusId" type="text" name="menusId" th:value="${ bean.menusId}" placeholder="所属菜单">
		 -->
		<select class="form-control" name="menusId" id="menusId">
			<option value="0">请选择</option>
			<option th:each="item : ${@portalPageHandle.menus()}" th:text="${item.menusName}" th:value="${item.id}" th:selected="${item.id eq bean.menusId}"></option>
		</select>
	</div>
</div>
<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">模块父类</label>
	<div class="col-md-9">
		<select class="form-control"  id="moduleParentId" name="moduleParentId" placeholder="模块父类">
			<option value="0">父类</option>
			<option th:each="item : ${parentModule}" th:text="${item.moduleName}" th:value="${item.id}"
					th:selected="${item.id eq bean.moduleParentId}"></option>
		</select>
	</div>
</div>
<div class="form-group row margin-right-0">
	<label class="col-md-2 col-form-label control-label" for="text-input">链接打开状态</label>
	<div class="col-md-9">
		<!-- 
		<input class="form-control" id="linkTarget" type="text" name="openTarget" th:value="${ bean.openTarget}" placeholder="链接打开状态">
		 -->
		 <div class="radio">
			<label class="checkbox-inline"><input type="radio" value="_blank" name="openTarget" id="openTarget" th:checked="${bean.openTarget eq '_blank'}"> 新标签</label>
		</div>
		<div class="radio">
			<label class="checkbox-inline"><input type="radio" value="_self" name="openTarget" id="openTarget" th:checked="${bean.openTarget eq '_self'}"> 本窗口</label>
		</div>
	</div>
</div>
							
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

	</div>

	
	<footer th:replace="dashboard/footer :: footer"></footer>
	<script type="text/javascript" th:src="@{/resources/js/project.js}"></script>

	<script type="text/javascript">
		
		var addForm = $("#addForm") ; 
		$(function(){
			addForm.validate({
				ignore: [],  
				rules: {
					moduleName: "required" ,
					modulePath: "required" ,
					moduleLogo: "required" ,
					moduleDesc: "required" , 
					openTarget: "required"  ,
					moduleSort: {required:true , number:true}
				}
			});
		}) ;

		function submitHandler() {
			var result = $.validate.form("addForm");
			if(result){	
				$.operate.save(ctx+"portal/desktop/web/module/update" , $('#addForm').serialize());
			}
	    }
		
	</script>
	
</body>
</html>

